<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   <%@include file="/view/resource.jsp" %>
<script type="text/javascript">
$("#selpjName").ready(function (){
	$.ajax({
		url:urls['msUrl']+"tostPjProjcttab/getProject.do",
		dataType:'json',
		success:function(result){
			var str="<select id='selpjId' name='pjId' onchange='getpjName()'><option></option>";
			for(var i=0;i<result.total;i++){
				str+="<option value='"+result.rows[i].id+"'>"+result.rows[i].pjProjectname+"</option>";
			}
			str+="</select>";
			document.getElementById("selpjName").innerHTML=str;
		}
	});
});   

function getpjName(){
	var obj = document.getElementById("selpjId");
	var index = obj.selectedIndex; // 选中索引
	var	text = obj.options[index].text;
	var	value =  obj.options[index].value;
	document.getElementById("pjName").value=text;
	getpjcostitem(value);
	getPcmempush(value);
}

function gethrName(){
	var obj = document.getElementById("hrId");
	var index = obj.selectedIndex; 	// 选中索引
	var	text = obj.options[index].text;
	document.getElementById("hrName").value=text;
}

function getPcmempush(pjid){
$("#selteamer").ready(function (){
	$.ajax({
		url:urls['msUrl']+"tostPjTeammemberinfo/querypersonbypjid.do?pjId="+pjid,
		dataType:'json',
		success:function(result){
			var str="<select id='hrId' name='hrId' onchange='gethrName()'><option></option>";
			for(var i=0;i<result.total;i++){
				str+="<option value='"+result.rows[i].hrId+"'>"+result.rows[i].hrName+"</option>";
			}
			str+="</select>";
			document.getElementById("selteamer").innerHTML=str;
		}
	});
});   
}

function getpjcostitem(pjid){
$("#selcostitem").ready(function (){
	$.ajax({
		url:urls['msUrl']+"tostPjCostitem/querycostitembypjid.do?pjId="+pjid,
		dataType:'json',
		success:function(result){
			var str="<select id='pctId' name='pctId'><option></option>";
			for(var i=0;i<result.total;i++){
				str+="<option value='"+result.rows[i].id+"'>"+result.rows[i].pctName+"</option>";
			}
			str+="</select>";
			document.getElementById("selcostitem").innerHTML=str;
		}
	});
});   
}
</script>
  </head>
  <body class="easyui-layout">
  	 <!-- Search panel start -->
 	 <div class="ui-search-panel" region="north" style="height: 80px;" title="过滤条件" data-options="striped: false,collapsible:false,iconCls:'icon-search',border:false" >   
 	 <form id="searchForm">
 	 	<input class="hidden" id='search_parentId' name="parentId">
 	 	<p class="ui-fields">
            <label class="ui-label">姓名:</label> 
            <input name="hrName" class="easyui-box ui-text" style="width:100px;">
        </p>
        <a id="btn-search" class="easyui-linkbutton" iconCls="icon-search">查询</a>
      </form>  
     </div> 
     <!--  Search panel end -->
     <!-- DataList  -->
	 <div region="center" border="false" >
     	<table id="data-list" ></table>
     </div>
    
     <!-- Edit Win&From -->
     <div id="edit-win" class="easyui-dialog" title="Edit Menu" data-options="closed:true,iconCls:'icon-save',modal:true"  style="width:500px;height:450px;">  
     	<form id="editForm" class="ui-form" method="post"> 
     	 <!-- 隐藏文本框 -->
     	 <input class="hidden" name="id">
     	 <input class="hidden" name="deleted">
    	 <input class="hidden" name="parentId" id='edit_parentId'>
	            <div data-options="region:'north',split:true" style="height:185px;padding:10px">  
	               <div class="ftitle">详细</div>   
		           <div class="fitem">  
		               <label>项目编号:</label>  
		               <span id="selpjName"></span>
		               <input type="hidden" name="pjName" id="pjName"/>
		           </div>   
		           <div class="fitem">  
		               <label>费用ID:</label>  
		               <span id="selcostitem"></span>
		           </div>  
		           <div class="fitem">  
		               <label>人员姓名:</label>  
		               <span id="selteamer"></span>
		               <input type="hidden" id="hrName" name="hrName" data-options="required:true">
		           </div>  
		           <div class="fitem">  
		               <label>开始时间:</label>  
		               <input class="easyui-datebox" type="text" name="mpmEntertime" data-options="required:true">
		           </div>  
		           <div class="fitem">  
		               <label>提成月数:</label>  
		               <input class="easyui-validatebox" id="monnum" type="text" name="mpmMonnum" value="1" data-options="required:true">
		           </div>  
		           <div class="fitem">  
		               <label>提成月份:</label>  
		               <input class="easyui-datebox" type="text" name="mpmMonth" data-options="required:true">
		           </div>  
		           <div class="fitem">  
		               <label>提成金额:</label>  
		               <input class="easyui-validatebox" type="text" id="tc" onKeyUp="tmulti('tot','monnum','tc')" name="mpmPushmoney" data-options="required:true">
		           </div>  
		           <div class="fitem">  
		               <label>提成合计:</label>  
		               <input class="easyui-validatebox" type="text" id="tot" name="mpmPycount" data-options="required:true">
		           </div>  
		            
	            </div>
     	</form>
  	 </div>
  	 
  	  <!--导入人头收入提成表 -->
 <div id="inport-win" class="easyui-dialog" title="批量导入人头收入提成" data-options="closed:true,iconCls:'icon-tip',modal:true"  style="width:400px;height:250px;">  
     	<form id="importForm" action="upload.do" class="ui-form" method="post" enctype="multipart/form-data" target="ifm"> 
     	 <!-- 隐藏文本框 --> 
    	 <div class="ui-edit"> 
    	   <div data-options="region:'north',split:true" style="height:185px;padding:10px"> 
		请选择导入文件:<br><input type="file" name="excelPath" value="选择文件">
		
		 <input type="submit" value="确认导入" >
		    </div>
     	</form>
     	<iframe id='ifm' name='ifm' style="visibility:hidden;display:none"></iframe>
   </div>
  	 
  <script type="text/javascript" src="<%=basePath%>/osjs/project/TostPjMempushmoney.js"></script>
  </body>
</html>